package com.hk.core.authentication.security.session;

import com.hk.core.web.Webs;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.web.session.SessionInformationExpiredEvent;
import org.springframework.security.web.session.SessionInformationExpiredStrategy;



/**
 * @author Kevin
 */
public record JsonSessionInformationExpiredStrategy(Object data)
        implements SessionInformationExpiredStrategy {

    @Override
    public void onExpiredSessionDetected(SessionInformationExpiredEvent event) {
        Webs.writeJson(event.getResponse(), HttpServletResponse.SC_OK, data);
    }
}
